package com.example.zxx.shardingsphere.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.zxx.shardingsphere.dao.UserMapper;
import com.example.zxx.shardingsphere.domain.entity.User;
import com.example.zxx.shardingsphere.service.UserService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author zhangxiaoxiang
 * @since 2021-09-14
 */
@Service
@RequiredArgsConstructor
@Slf4j
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    private final UserMapper userMapper;

    @Override
    public String createTable(String tableName) {
        try {
            userMapper.createTable(tableName);
            return "创建表成功";
        } catch (Exception e) {
            log.info("创建表异常:" + e.getMessage(), e);
            return "创建表失败";
        }

    }
}
